package com.jdk.demo.nio.networkinterface;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressDemo2 {

	public static void main(String[] args) throws UnknownHostException {
		InetAddress address1 = InetAddress.getLocalHost();
		System.out.println("A1 " + address1.getCanonicalHostName());
		System.out.println("A2 " + address1.getHostName());
		System.out.println();

		InetAddress address2 = InetAddress.getByName("localhost");
		System.out.println("B1 " + address2.getCanonicalHostName());
		System.out.println("B2 " + address2.getHostName());
		System.out.println();

		InetAddress address3 = InetAddress.getByName("127.0.0.1");
		System.out.println("C1 " + address3.getCanonicalHostName());
		System.out.println("C2 " + address3.getHostName());
		System.out.println();
	}

}
